<?php
namespace App\HttpController\Pudu;

use App\Common\Controller\Rest;

class ShopRecords extends Rest
{
    public $modelName = 'ShopRecord';   // model 类名称

    public function POSTIndex()
    {
        switch($this->param['type']){
            case 1:
                $emoney = $this->model('Shop') -> where(['id' => $this->param['userId']]) -> value('emoney');
                $this->param['remain'] = $emoney + $this->param['change'];
            break;
        }

        $res = $this->model()->createData($this->param);
        $this->result($res, ['msg' => self::$model->getError()]);
    }
}
